/*
 * Copyright (c) 2020-2021, Bluetrum Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021/10/21     AlgoIdeas    The first version
 */

#ifndef APPLICATIONS_GPS_H_
#define APPLICATIONS_GPS_H_

#include <stdint.h>

#if defined(__cplusplus) || defined(c_plusplus)
extern "C"{
#endif

/* Clock */
typedef struct
{
    uint16_t year;
    uint8_t month;
    uint8_t day;
    uint8_t week;
    uint8_t hour;
    uint8_t minute;
    uint8_t second;
    uint16_t millisecond;
} Clock_Info_t;

/* GPS */
typedef struct
{
    bool isVaild;
    float longitude;
    float latitude;
    float altitude;
    float course;
    float speed;
    int16_t satellites;
    Clock_Info_t clock;
} GPS_Info_t;


typedef rt_int32_t (*gps_callback_t)(GPS_Info_t info);

int gps_init(gps_callback_t callback);

bool gps_get_info(GPS_Info_t* info);

float gps_get_distance(GPS_Info_t* info, float preLong, float preLat);

#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif /* APPLICATIONS_GPS_H_ */
